home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 17
/
CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso
/
CUCD
/
Programming
/
DiceSource
/
lib
/
extra
/
waitmsg.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-09
|
818b
|
36 lines
/*
* WAITMSG.C
*
* (c)Copyright 1992-1997 Obvious Implementations Corp. Redistribution and
* use is allowed under the terms of the DICE-LICENSE FILE,
* DICE-LICENSE.TXT.
*
* Wait for a message to be returned, suitable when another task is doing
* the ReplyMsg(). NOT suitable for when an interrupt is doing the
* ReplyMsg() (must use Disable()/Enable() pair instead of Forbid()/
* Permit() if used with interrupts)
*/
#include <exec/types.h>
#include <exec/ports.h>
#include <clib/exec_protos.h>
#include <stdio.h>
typedef struct Message Message;
typedef struct MsgPort MsgPort;
void WaitMsg(Message *);
void
WaitMsg(msg)
Message *msg;
{
while (msg->mn_Node.ln_Type != NT_REPLYMSG)
Wait(1 << msg->mn_ReplyPort->mp_SigBit);
Forbid();
Remove(&msg->mn_Node);
Permit();
}